package net.cyndeline.entitySystem.event

import net.cyndeline.entitySystem.Component
import net.cyndeline.entitySystem.Event
import net.cyndeline.events.ModifyError

class ChangedComponent extends ChangedComponentEvent with ModifyError {
  private var comp: Component = _
  
  override def component: Component = comp
  override def component_=(c: Component) {
    modify("component", this)
    comp = c
  }
  
  override def copy = {
    val copy = new ChangedComponent()
    copy.component = comp.copy
    copy
  }
}

trait ChangedComponentEvent extends Event {
  def component: Component
  def component_=(comp: Component)
}